﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COM.Rights.Model;

namespace System.Web
{
    public class ZASession :ZSession
    {
        public static string AlipayCarLogin
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["alipayCarLogin"] != null)
                {
                    return System.Web.HttpContext.Current.Session["alipayCarLogin"].ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["alipayCarLogin"] = value;
            }
        }
        public static string AlipayToken
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["alipayToken"] != null)
                {
                    return System.Web.HttpContext.Current.Session["alipayToken"].ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["alipayToken"] = value;
            }
        }
        public static string MemberLevelID
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["memberLevelID"] != null)
                {
                    return System.Web.HttpContext.Current.Session["memberLevelID"].ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["memberLevelID"] = value;
            }
        }
        public static string MemberPointsTotal
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["MemberPointsTotal"] != null)
                {
                    return System.Web.HttpContext.Current.Session["MemberPointsTotal"].ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["MemberPointsTotal"] = value;
            }
        }
        public static string MemberPointsAvailable
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["MemberPointsAvailable"] != null)
                {
                    return System.Web.HttpContext.Current.Session["MemberPointsAvailable"].ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["MemberPointsAvailable"] = value;
            }
        }
        public static string MemberName
        {
            get
            {
                if (System.Web.HttpContext.Current.Session != null && System.Web.HttpContext.Current.Session["MemberName"] != null)
                {
                    return System.Web.HttpContext.Current.Session["MemberName"].ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["MemberName"] = value;
            }
        }

        public static string MemberPic
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["MemberPic"] != null)
                {
                    return System.Web.HttpContext.Current.Session["MemberPic"].ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["MemberPic"] = value;
            }
        }

        public static string MemberHome
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["MemberHome"] != null)
                {
                    return System.Web.HttpContext.Current.Session["MemberHome"].ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["MemberHome"] = value;
            }
        }

        public static string MemberFood
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["MemberFood"] != null)
                {
                    return System.Web.HttpContext.Current.Session["MemberFood"].ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["MemberFood"] = value;
            }
        }

        public static string MemberSports
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["MemberSports"] != null)
                {
                    return System.Web.HttpContext.Current.Session["MemberSports"].ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["MemberSports"] = value;
            }
        }

        public static string MemberID
        {
            get
            {
                if (System.Web.HttpContext.Current.Session != null && System.Web.HttpContext.Current.Session["memberID"] != null)
                {
                    return System.Web.HttpContext.Current.Session["memberID"].ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["memberID"] = value;
            }
        }

        public static string CarID
        {
            get
            {
                if (System.Web.HttpContext.Current.Session != null && System.Web.HttpContext.Current.Request.Cookies["SessionID"] != null)
                {
                    return System.Web.HttpContext.Current.Request.Cookies["SessionID"].Value.ToString();
                }
                else
                {
                    CarID = "";
                    return System.Web.HttpContext.Current.Session.SessionID;

                }
            }
            set
            {
                System.Web.HttpContext.Current.Response.Cookies.Add(new System.Web.HttpCookie("SessionID", System.Web.HttpContext.Current.Session.SessionID));
            }
        }

        public static string ValidateCode
        {
            get
            { return StringHelper.FormatObjToString(System.Web.HttpContext.Current.Session["RegisterValidateCode"]); }
            set
            { System.Web.HttpContext.Current.Session["RegisterValidateCode"] = value; }
        }
        public static string ValidateCodeAdmin
        {
            get
            { return StringHelper.FormatObjToString(System.Web.HttpContext.Current.Session["ValidateCodeAdmin"]); }
            set
            { System.Web.HttpContext.Current.Session["ValidateCodeAdmin"] = value; }
        }


        public static string ValidateCodeComment
        {
            get
            { return StringHelper.FormatObjToString(System.Web.HttpContext.Current.Session["ValidateCodeComment"]); }
            set
            { System.Web.HttpContext.Current.Session["ValidateCodeComment"] = value; }
        }

        public static string Account
        {
            get
            {
                if (System.Web.HttpContext.Current.Session != null && System.Web.HttpContext.Current.Session["Account"] != null)
                    return System.Web.HttpContext.Current.Session["Account"].ToString();
                else return null;
            }
            set
            { System.Web.HttpContext.Current.Session["Account"] = value; }
        }

        public static string OrdersID
        {
            get
            { return System.Web.HttpContext.Current.Session["OrdersID"].ToString(); }
            set
            { System.Web.HttpContext.Current.Session["OrdersID"] = value; }
        }
        public static string BankValue
        {
            get
            { return System.Web.HttpContext.Current.Session["BankValue"].ToString(); }
            set
            { System.Web.HttpContext.Current.Session["BankValue"] = value; }
        }

        public static string RegSuccessValue
        {
            get
            { return System.Web.HttpContext.Current.Session["RegSuccessValue"].ToString(); }
            set
            { System.Web.HttpContext.Current.Session["RegSuccessValue"] = value; }
        }
        public static string Bill99Value
        {
            get
            { return System.Web.HttpContext.Current.Session["Bill99Value"].ToString(); }
            set
            { System.Web.HttpContext.Current.Session["Bill99Value"] = value; }
        }


        public static string VisitorUnID
        {
            get
            {
                string visitUnID = "";
                if (System.Web.HttpContext.Current.Request.Cookies["VisitorUnID"] == null || string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Cookies["VisitorUnID"].Value))
                {
                    visitUnID = Guid.NewGuid().ToString();
                    HttpCookie visitCookie = new HttpCookie("VisitorUnID", visitUnID);
                    visitCookie.Path = "/";
                    visitCookie.Expires = DateTime.Now.Add(new TimeSpan(3650, 0, 0, 0));
                    System.Web.HttpContext.Current.Response.Cookies.Add(visitCookie);
                }
                else
                {
                    visitUnID = System.Web.HttpContext.Current.Request.Cookies["VisitorUnID"].Value;
                }
                return visitUnID;
            }
        }
        public static string QQrequesttokenkey
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["QQrequesttokenkey"] != null)
                {
                    return System.Web.HttpContext.Current.Session["QQrequesttokenkey"].ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["QQrequesttokenkey"] = value;
            }
        }
        public static string QQrequesttokensecret
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["QQrequesttokensecret"] != null)
                {
                    return System.Web.HttpContext.Current.Session["QQrequesttokensecret"].ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["QQrequesttokensecret"] = value;
            }
        }


        public static Dictionary<string, TFunctionInfo> Functions
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["Functions"] != null)
                {
                    return System.Web.HttpContext.Current.Session["Functions"] as Dictionary<string, TFunctionInfo>;
                }
                else
                {
                    return null;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["Functions"] = value;
            }
        }

        public static List<string> RoleNames
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["RoleNames"] != null)
                {
                    return System.Web.HttpContext.Current.Session["RoleNames"] as List<string>;
                }
                else
                {
                    return null;
                }
            }
            set
            {
                System.Web.HttpContext.Current.Session["RoleNames"] = value;
            }
        }
    }
}
